主题
生成二维码 - CreateQRCodeEx
函数简介
根据字符串数据生成二维码图片,支持自定义版本、容错等级和编码模式。
接口名称
CreateQRCodeExDLL调用
long CreateQRCodeEx(long ola, string str, int pixelsPerModule, int version, int correctionLevel, int mode, int structureNumber);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| str | 字符串 | 生成二维码的字符串数据 |
| pixelsPerModule | 整数型 | 每个数据像素大小 |
| version | 整数型 | 二维码版本 |
| correctionLevel | 整数型 | 容错等级:0 CORRECT_LEVEL_L、1 CORRECT_LEVEL_M、2 CORRECT_LEVEL_Q、3 CORRECT_LEVEL_H |
| mode | 整数型 | 字节编码模式:-1 AUTO、1 NUMERIC、2 ALPHANUMERIC、4 BYTE、7 ECI、8 KANJI、3 STRUCTURED_APPEND |
| structureNumber | 整数型 | 结构化追加的首个码索引 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long handle = ola.CreateQRCodeEx("value", 0, 0, 0, 0, 0);csharp
using OLAPlug;
var ola = new OLAPlugServer();
long handle = ola.CreateQRCodeEx("value", 0, 0, 0, 0, 0);python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
handle = ola.CreateQRCodeEx("value", 0, 0, 0, 0, 0)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
long handle = ola.CreateQRCodeEx("value", 0, 0, 0, 0, 0);cpp
var ola = com("OlaPlug.OlaSoft")
var handle = ola.CreateQRCodeEx("value", 0, 0, 0, 0, 0)vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
handle = ola.CreateQRCodeEx("value", 0, 0, 0, 0, 0)text
.局部变量 ola, OLAPlug
ola.创建 ()
handle = ola.CreateQRCodeEx("value", 0, 0, 0, 0, 0)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var handle = ola.CreateQRCodeEx("value", 0, 0, 0, 0, 0);text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
长整数 handle = ola.CreateQRCodeEx("value", 0, 0, 0, 0, 0)cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long handle = ola.CreateQRCodeEx("value", 0, 0, 0, 0, 0);原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
CreateQRCodeEx(instance, "value", 0, 0, 0, 0, 0);csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateQRCodeEx(long ola, string str, int pixelsPerModule, int version, int correctionLevel, int mode, int structureNumber);
long instance = CreateCOLAPlugInterFace();
CreateQRCodeEx(instance, "value", 0, 0, 0, 0, 0);python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ola.CreateQRCodeEx(instance, "value", 0, 0, 0, 0, 0)返回值
长整数型:返回OLAImage对象的地址,失败返回0。
注意事项
- 返回的图片需调用 FreeImagePtr 释放内存。
